﻿<!DOCTYPE html>
<?php
	include '../functions.php'; 	
        requestHTTPS();
        inclHeader();
        if(isset($_SESSION["admin"]))
            header("Location: ./adminSite.php");
	if (isset($_GET["call"])){
		if ($_GET["call"] == "cookie"){
			define( "ONE_HOUR", 60 * 60 ); // define constant
			// write each form field’s value to a cookie and set the 
			// cookie’s expiration date
			setcookie( "AdminUserName", $_SESSION['adminUname'], time() + ONE_HOUR );    
			setcookie( "AdminPassword", $_SESSION['adminPass'], time() + ONE_HOUR );
			header("Location: ../index.php");
		}
	}
        //Preusmeritev, če že obstaja aktiven admin, na njegovo glavno stran
        if(isset($_SESSION['admin']))
            header("Location: ./adminSite.php");

?>
<html>
  <head> 
	<link rel = "stylesheet"  type = "text/css" href = "../CSS.css" />
	<meta charset = "utf-8">
  	<title> Podutik Records </title>
  	<style type="text/css"></style>
	<script src="../jquery.js"></script>
	<script src="../myQuery.js"></script>
	<script src="../prevod.js"></script>
  </head>
  <body>
	<div id="page-container">

		<div id="main-nav">	
			<div class="block" id="bl1" style="background-color: #EEEEEE;">
				
			</div>			
		</div>
			
		<div id="header">		
			<a href="../index.php"><img id="logo1" src="../podutikrecords1.jpg" 
			width="236" height="36" alt="Enlighten Designs" /></a>	
		</div>
		
		<div id="prijava">
			<h2 id="alogin">Administrator Login</h2>
			<div class="obrazec">
				<div style="width: 650px;">
				<form name ="AdminPrijava" id="aregistracija" method="post" action="#">
					<h3>
                                            <label id="auname">Username: </label>
                                            <input type="text" name="AdminLoginUsername" class="reginp" id="loguname" class="inputlog" size="30" 
                                                   value="<?php 
                                                        if (isset($_POST['AdminLoginUsername'])) {      //Admin username je kr ImePriimek 
                                                            echo $_POST['AdminLoginUsername'];
                                                        } 
                                                        else if (isset($_COOKIE["AdminUserName"])) {
                                                            echo $_COOKIE["AdminUserName"];}?>"/>
                                        </h3>
                                        <h5 id="logunameerr" style="visibility: hidden;">*Wrong username</h5>
					<br/>
					<h3>
                                            <label id="pass">Password: </label>
                                            <input type="password" name="AdminLoginPassword" class="reginp" id="logpass" class="inputlog" size="30" 
                                                   value="<?php 
                                                        if (isset($_POST['AdminLoginPassword'])) {
                                                            echo $_POST['AdminLoginPasword'];
                                                        }
                                                        else if (isset($_COOKIE["AdminUserName"])) {
                                                            echo $_COOKIE["AdminUserName"];}?>"/>
                                        </h3>
                                        <h5 id ="logpasserr" style="visibility: hidden;">*Wrong password</h5>
					<!--<input type = "submit" value = "Submit">-->
					<br/>
					<h1><input type="image" id="log" src="../loginpic.jpg" alt="prijava"/></h1> <!-- Gumb za prijavo -->
				</form>
				</div>
			</div>	
		</div>
		
		<?php
                    footer();
                ?>
	
	</div>
    
	<?php
		adminLogin();       
	?>
	
  </body>
  <script src="logforms1.js"></script>
  
</html>